export const billApi = {
  getBillList: async (userId) => {
    const url = `http://localhost:6008/phone-client/api/bill/getBillListByUserId/${userId}`;

    const res = await uni.request({
      url: url,
      method: 'POST', // 与后端@PostMapping对应
      timeout: 10000
    });

    // 统一响应处理
    if (res.statusCode !== 200) {
      throw new Error(`请求失败: ${res.statusCode}`);
    }
    if (res.errMsg.includes('fail')) {
      throw new Error(`网络错误: ${res.errMsg}`);
    }
    return res.data;
  }
};